package com.peoject.dao;

import com.peoject.dto.NoteDto;
import com.peoject.entity.NoteEntity;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

public interface INoteDao extends CrudRepository<NoteEntity,Long> {
    @Query(value = "select new com.peoject.dto.NoteDto(n.type,n.noteEsId,n.title) from  NoteEntity n where  n.type=?1",
            countQuery = "select count(n.noteId) from  NoteEntity n where  n.type=?1")
    Page<NoteDto> page(String type, PageRequest request);
    @Query(value = "select new com.peoject.dto.NoteDto(n.type,n.noteEsId,n.title) from  NoteEntity n ",
            countQuery = "select count(n.noteId) from  NoteEntity n ")
    Page<NoteDto> page(PageRequest request);
}
